package cn.zyq.ykb.controller.h5.task;

import cn.hutool.core.bean.BeanUtil;
import cn.zyq.ykb.beans.task.Task;
import cn.zyq.ykb.mapper.task.TaskPriceMapper;
import org.springframework.security.access.prepost.PreAuthorize;
import cn.zyq.ykb.system.ry.util.poi.ExcelUtil;
import cn.zyq.ykb.system.common.BaseController;
import cn.zyq.ykb.system.annotation.Log;
import cn.zyq.ykb.system.ry.enums.BusinessType;
import cn.zyq.ykb.beans.task.TaskPrice;
import cn.zyq.ykb.service.task.TaskPriceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import cn.zyq.ykb.system.common.BaseController;
import cn.zyq.ykb.system.common.PageParam;

import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.List;

/**
 * 任务调价Controller
 *
 * @author SystemAuth
 * @date 2023-11-28
 */

@RestController(value = "H5TaskPriceController")
@RequestMapping("/api/taskPrice")
@Api(tags = "任务调价接口")
public class TaskPriceController extends BaseController {

    @Autowired
    private TaskPriceService taskPriceService;
    @Autowired
    private TaskPriceMapper taskPriceMapper;
    /**
     * 获取任务调价详细信息
     */
    @ApiOperation(value = "详情", response = TaskPrice.class)
    @GetMapping(value = "/{taskID}")
    public Object getInfo(@PathVariable("taskID") Integer taskID) {
        TaskPrice taskPrice = new TaskPrice();
        taskPrice.setTaskID(taskID);
        taskPrice.setUserID(this.getLoginUser().getUserID());
        TaskPrice taskPrice1 = this.taskPriceMapper.selectOne(taskPrice);
        if (BeanUtil.isEmpty(taskPrice1)){
            taskPrice1 = new TaskPrice();
            taskPrice1.setTemPrice(new BigDecimal(0));
            taskPrice1.setUserPrice(new BigDecimal(0));
        }
        return taskPrice1;
    }

}
